<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/commonEdit.jsp"%>
<%@ include file="/commons/validation.jsp"%>
<%@ include file="/commons/dateTime.jsp" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>月结</title>
<script type="text/javascript" src="${ctx }/scripts/public3.js"></script>
<script type="text/javascript" src="${ctx}/scripts/public.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common/prototype.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/div/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/ajaxException.js"></script>

<script type="text/javascript">

	function setButtonStatus(status){ //设置按钮状态 true 代表可用 false代表不可用
		$("btn1_22").disabled = !status;
		$("btn1_32").disabled = !status;
	}

	function saveWin(){
		var isTrue=$("monthlyStatementForm").fireEvent("onSubmit");
  		if(isTrue){
  			setButtonStatus(false);
			findFrame('main').ongoing($('firstPayDate').value,$('lastPayDate').value);
			windowClose();
		}
	}
</script>

</head>

<body >
<form id="monthlyStatementForm" name="monthlyStatementForm" method="post" action=""  class="required-validate" >
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
	  <tr>
	    <td class="window_head_outBg">
	    <table border="0" cellpadding="0" cellspacing="0">
		      <tr><td><img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle" /> <span class="window_head_intext">月结</span></td></tr>
	    </table>
	    </td>
	  </tr>
	  <tr><td class="aux_header_line_1"></td></tr>
	  <tr><td class="aux_header_line_2"></td></tr>
	  <tr>
	    <td class="content">

		<table width="100%" border="0" cellspacing="0" cellpadding="0">
	      <tr>
	        <td class="aux_outtable_color">
	        <table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color">
	            <tr>
	              <td class="aux_intable_td1">当前月结周期：</td>
	              <td class="aux_intable_td2">${period}</td>
	            </tr>
	            <tr><td colspan="2" valign="middle" class="aux_titletable">下周期缴费日期设置</td></tr>
	            <tr>
	              <td class="aux_intable_td1">截止缴费日期：</td>
	              <td class="aux_intable_require">
	              		<input name="endDate" id="endDate" type="hidden" value="${endDate}">
	              		<input name="firstPayDate" id="firstPayDate"  type="text" class="required validate-date great-than-endDate"  size="16" validateMessage="截止缴费日期必须大于 ${newPeriod} 周期最后一天 ${endDate}" afterInsert="firstPayDateSpan" />
						<img id="imgFirstPayDate" name="imgFirstPayDate" src="${ctx}/images/ico_clock_month.gif" width="20" height="20" /><span id="firstPayDateSpan"></span>
				  </td>
	            </tr>
	            <tr>
	              <td class="aux_intable_td1">优惠期截止缴费日期：</td>
	              <td class="aux_intable_require">
						<input name="lastPayDate" id="lastPayDate"  type="text" class="required validate-date  great-than-firstPayDate" validateMessage="优惠期截止缴费日期必须大于截止缴费日期"  size="16" afterInsert="lastPayDateSpan" />
						<img id="imgLastPayDate" name="imgLastPayDate" src="${ctx}/images/ico_clock_month.gif" width="20" height="20" /><span id="lastPayDateSpan"></span>
	              </td>
	              </tr>
	          </table>
	        </td>
	      </tr>
	    </table>

		</td>
	  </tr>
	  <tr>
	    <td class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
	      <tr>
	        <td class="btn_between_space">&nbsp;</td>
	        <td><table border="0" cellpadding="0" cellspacing="0">
	            <tr>
	              <td class="buttonOffLeft" id="btn1_21"></td>
	              <td class="buttonOffMiddle" id="btn1_22" onClick="saveWin();" onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)" onBlur="btn_change(2)"><img src="${ctx}/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 保 存</td>
	              <td class="buttonOffRight" id="btn1_23"></td>
	            </tr>
	        </table></td>
	        <td class="btn_between_space"></td>
	        <td><table border="0" cellpadding="0" cellspacing="0">
	            <tr>
	              <td class="buttonOffLeft" id="btn1_31"></td>
	              <td class="buttonOffMiddle" id="btn1_32" onClick="windowClose();" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)" onBlur="btn_change(3)"><img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 关 闭</td>
	              <td class="buttonOffRight" id="btn1_33"></td>
	            </tr>
	        </table></td>
	      </tr>
	    </table></td>
	  </tr>
	</table>
</form>

<script type="text/javascript">

              Calendar.setup(
              {
	              inputField : "firstPayDate", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "imgFirstPayDate", // ID of the button
	             // align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );

               Calendar.setup(
              {
	              inputField : "lastPayDate", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "imgLastPayDate", // ID of the button
	             // align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );

</script>

</body>
</html>